<?php
        include('inc-login.php');
$txt.=' <p align="center"><font face="Verdana"><b>Calculadora de préstamos </b></font></p>
<form name="loandata">
  <table height="232">
    <tr>
      <td colspan="3" height="42">
      <div class="result">
        <font face="Verdana" style="font-size: 9pt; font-weight: 700">Introduce la información sobre el préstamo:</font></div>
      </td>
    </tr>
    <tr>
      <td height="22">
      <div class="result">
        <font face="Verdana" style="font-size: 9pt">1)</font></div>
      </td>
      <td height="22">
      <div class="result">
        <font face="Verdana" style="font-size: 9pt">Cantidad a prestar:</font></div>
      </td>
      <td height="22"><font face="Verdana" style="font-size: 9pt">
      <input type="text" name="principal" size="12" ></font></td>
    </tr>
    <tr>
      <td height="22">
      <div class="result">
        <font face="Verdana" style="font-size: 9pt">2)</font></div>
      </td>
      <td height="22">
      <div class="result">
        <font face="Verdana" style="font-size: 9pt">Interés por pago:</font></div>
      </td>
      <td height="22"><font face="Verdana" style="font-size: 9pt">
      <input type="text" name="interest" size="12" ></font></td>
    </tr>
    <tr>
      <td height="22">
      <div class="result">
        <font face="Verdana" style="font-size: 9pt">3)</font></div>
      </td>
      <td height="22">
      <div class="result">
        <font face="Verdana" style="font-size: 9pt">Cantidades de pago:</font></div>
      </td>
      <td height="22"><font face="Verdana" style="font-size: 9pt">
      <input type="text" name="pays" size="12" ></font></td>
    </tr>
    <tr>
      <td colspan="3" height="26">
      <div class="result">
        <font face="Verdana" style="font-size: 9pt">
        <input type="button" value="Calcular" onClick="calculate()"> Información 
        sobre pagos:</font></div>
      </td>
    </tr>
    <tr>
      <td height="22">
      <div class="result">
        <font face="Verdana" style="font-size: 9pt">4)</font></div>
      </td>
      <td height="22">
      <div class="result">
        <font face="Verdana" style="font-size: 9pt">Cantidad a pagar en cada plazo:</font></div>
      </td> 
      <td height="22"><font face="Verdana" style="font-size: 9pt">
      <input type="text" name="payment" size="12"onChange="calculate()"></font></td> &nbsp; <td height="22"><font face="Verdana" style="font-size: 9pt">
      <input type="text" name="paymentx" size="12"onChange="calculate()"></font></td>
    </tr> 
    <tr>
      <td height="22">
      <div class="result">
        <font face="Verdana" style="font-size: 9pt">5)</font></div>
      </td>
      <td height="22">
      <div class="result">
        <font face="Verdana" style="font-size: 9pt">Coste total:</font></div>
      </td>
      <td height="22"><font face="Verdana" style="font-size: 9pt">
      <input type="text" name="costetotal" size="12"onChange="calculate()"></font></td> &nbsp; <td height="22"><font face="Verdana" style="font-size: 9pt">
      <input type="text" name="costetotalx" size="12"onChange="calculate()"></font></td>
    </tr>
    <tr>
      <td height="22">
      <div class="result">
        <font face="Verdana" style="font-size: 9pt">6)</font></div>
      </td>
      <td height="22">
      <div class="result">
        <font face="Verdana" style="font-size: 9pt">Interés total:</font></div>
      </td>
      <td height="22"><font face="Verdana" style="font-size: 9pt">
      <input type="text" name="interestotal" size="12"onChange="calculate()"></font></td> &nbsp; <td height="22"><font face="Verdana" style="font-size: 9pt">
      <input type="text" name="interestotalx" size="12"onChange="calculate()"></font></td>
    </tr>
  </table>
  <br><br>
  <font style="font-size: 9pt"><b>Utilizar siempre la primera columna que son las cantidades redondeadas, para que se pueda utilizar en MunVi, en la siguiente columna tenéis los resultados sin redondear.</b></font>
</form>
<script type="text/javascript">
function calculate() {
  var principal = document.loandata.principal.value;
  var interest  = document.loandata.interest.value;
  var payments  = document.loandata.pays.value;
  var x         = ((interest * principal) / 100);
  document.loandata.payment.value=Math.round ((principal / payments ) + x); 
  document.loandata.costetotal.value= Math.round( ((principal / payments ) + x) * payments );
  document.loandata.interestotal.value=Math.round ( payments * interest );
  document.loandata.paymentx.value= ((principal / payments ) + x); 
  document.loandata.costetotalx.value=( ((principal / payments ) + x) * payments );
  document.loandata.interestotalx.value= ( payments * interest );

  }
function round(x) {return Math.round(x *1)/1;}
</script>
';
include('theme.php');
?>
